<template>
  <div class="RoseChartbox">
    <div class="RoseChart">
      <PieChart
        class="RoseChartpic"
        :data="sortData"
        :color="color"
        text=""
        src=""
      />
    </div>
    <div class="RoseCharttext">
      <div v-for="(v, i) in sortData" :key="i" class="text_a">
        <div
        class="pieText"
        :style="`border-left: .1875rem solid ${color[i]} `"
        >
          {{ v.x }}
        </div>
        <div class="pieNum">{{ v.y }} 次</div>
      </div>
    </div>
  </div>
</template>

<script>
import PieChart from '@/components/chart/pie/PieChart.vue';
export default {
  components: {
    PieChart
  },
  props: {
    color: {
      typeof: Array,
      default: () => [
        '#5087EC',
        '#34C8FF',
        '#00FDFF',
        '#6FFACB',
        '#FFD101',
        '#FB9B2A',
        '#864bff',
        '#EF303B'
      ]
    },
    pieData: {
      typeof: Array,
      default: () => []
    }
  },
  computed: {
    sortData() {
      const list = [...this.pieData];
      const data = list.sort((a, b) => {
        return a.x.length - b.x.length;
      });
      return data;
    }
  }
};
</script>

<style lang="scss" scoped>
  .RoseChart{
    width: 8.8125rem;
    height: 8.8125rem;
    margin-right: 1.25rem;
  }
  .RoseChartbox{
    display: flex;
  }
  .text_third{
    margin-right: 1.375rem;
  }
  .RoseCharttext{
    width: 11.25rem;
    margin-top: .625rem;
    flex-wrap: wrap;
    justify-content: space-between;
    display: flex;
    .pieText{
      color: #CDDEEF;
      font-size: .75rem;
      margin-bottom: .3125rem;
      margin-right: 15px;
      padding-left: .125rem;
      height: .625rem;
      line-height: .625rem;
    }
    .pieNum{
      color: #FFFFFF;
      font-size: .75rem;
      padding-left: .1875rem;
    }
  }
</style>
